from . import db

# class dbcol(object):


class User(object):
    __tablename__ = 'users'
    # id = db.Column(db.Integer, primary_key=True)
    # username = db.Column(db.String(64), unique=True, index=True)
    # role_id = db.Column(db.Integer, db.ForeignKey('roles.id'))
    def __init__(self, userid, username):
        self.userid = userid
        self.username = username

    @staticmethod
    def query(userid=None, username=None):
        return None

    def __repr__(self):
        return '<User %r>' % self.username



class Job(object):
    __tablename__ = 'jobs'


    def __init__(self, jobid, username, codedir, status, process):
        self.jobid = jobid
        self.username = username
        self.codedir = codedir
        self.status = status
        self.process = process

    @staticmethod
    def query(jobid=None, username=None, codedir=None, status=None, process=None):
        return None

    def __repr__(self):
        return '<Job %r>' % str(self.jobid)


class Resource(object):
    __tablename__ = 'resources'

    def __init__(self, nodeid, gpuid, num_jobs, available_mem, jobids):
        self.nodeid = nodeid
        self.gpuid = gpuid
        self.num_jobs = num_jobs
        self.available_mem = available_mem
        self.jobids = jobids

    @staticmethod
    def query(nodeid=None, gpuid=None, num_jobs=None, available_mem=None, jobids=None):
        return None

    def __repr__(self):
        return '<resource %r>' % str(self.nodeid) + str(self.gpuid)


class Dataset(object):
    __tablename__ = 'datasets'
    # id = db.Column(db.Integer, primary_key=True)
    # username = db.Column(db.String(64), unique=True, index=True)
    # role_id = db.Column(db.Integer, db.ForeignKey('roles.id'))
    def __init__(self, dataset):
        self.dataset = dataset

    @staticmethod
    def query(dataset=None):
        return None

    def __repr__(self):
        return '<Dataset %r>' % self.dataset    

